﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<%
if sid="Null" then Response.Redirect "/login.asp?sid="&sidd&"&url=/user/usermima.asp"
IF (Request.QueryString("Action")="save") Then
	call save
else
	call add
End IF
end Function
%>
<%sub add
	dim url,i
	url=Request("url")
	if url="" then url="index.asp"
select case v
case "0"
%>
<card id="add" title="修改密码"><p align="<%=qingtian.px%>">
<b>你好<%=session("username")%>(ID:<%=qingtian.nid%>)请修改好你的密码!</b><br/>
-------------<br/>
		原密码:<br/>
		<input name="users" emptyok="true" size='15' type="text"/><br/>
		新密码:<br/>
		<input name="shen" emptyok="true" size='15' type="text"/><br/>
		再次输入新的密码:<br/>
		<input name="shii" emptyok="true" size='15' type="text"/><br/>
		<anchor>更改
			<go href="usermima.asp?Action=save&amp;sid=<%=sidd%>" method="post">
				<postfield name="users" value="$(users:n)" />
				<postfield name="shen" value="$(shen:n)" />
				<postfield name="shii" value="$(shii:n)" />
			</go>
		</anchor><br/>(注意不可以留空哦!)
<br/>-------------<br/>
<%=sou%><a href="UserInfo.Asp?sid=<%=sidd%>">我的详细资料</a><%=we0%>
<%
case "1"
hr=""
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
%>
<title>修改密码</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%=dao%><b>你好<%=session("username")%>(ID:<%=qingtian.nid%>)请完善你的密码!</b><%=we0%><%=hr%><%=we%>
<form action="usermima.asp?Action=save&amp;sid=<%=sidd%>" method="post">
		原密码:<br/>
		<input name="users" emptyok="true" size='15' type="text" /><br/>
		新密码:<br/>
		<input name="shen" emptyok="true" size='15' type="text" /><br/>
		再次输入新的密码:<br/>
		<input name="shii" emptyok="true" size='15' type="text" /><br/>
                <input type="submit" value="更改" /></form><br/>(注意不可以留空哦!)<%=we0%><%=hr%>
			<%=sou%><a href="UserInfo.Asp?sid=<%=sidd%>">我的详细资料</a><%=we0%>
<%
End Select
end sub
%>
<%sub save
	dim rs,sql,rs8,sql8,i,id

	dim name,pass,users,errmsg,flag,pic,shen,shii

		shen=Replace(trim(Request.form("shen")),"'","''")
		shii=Replace(trim(Request.form("shii")),"'","''")
		users=Replace(trim(Request.form("users")),"'","''")

select case v
case "0"
we0="<br/>"
title1="<card id=""login"" title=""修改密码""  ontimer=""usermima.asp?Action=add&amp;sid="&sidd&"""><timer value='20'/><p align="""&qingtian.px&""">"
title2="<card id=""save"" title=""修改密码""><p align="""&qingtian.px&""">"
case "1"
hr=""
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
title1="<meta name=""keywords"" content="",V1.0""/><meta name=""author"" content=""晴天建站""/><meta http-equiv=""Cache-Control"" content=""max-age=0"" forua=""true""/><meta http-equiv=""Cache-Control"" content=""no-cache""/><meta http-equiv=""Expires"" content=""0""/><meta http-equiv=""Refresh"" content=""1; url=usermima.asp?Action=add&amp;sid="&sidd&"""><title>修改密码</title></head><body>"
title2="<title>修改密码</title></head><body>"
End Select
		if len(users)="" or len(shen)="" then errmsg=errmsg&""&we&"输入的密码不能为空"&we0&"":flag=0
		if len(shen)<>len(shii) then errmsg=errmsg&""&we&"两次输入的新密码不相等"&we0&"":flag=0
	IF  flag<>"0" Then
		set rs=Server.CreateObject("Adodb.Recordset")
  		sql="select pass FROM qingtian_user where sid='"&qingtian.Formatsid(sid)&"'"
  		rs.open sql,conn,1,1
		if not (rs.bof and rs.eof)  then
                if rs("pass")<>md5(users)  then
		%>
			<%=title1%>
			<%=we%>你输入的原密码不正确<%=we0%>
			<%=sou%><a href="usermima.asp?Action=add&amp;sid=<%=sidd%>">返回上级</a><%=we0%>
			<%=we%><a href="UserInfo.Asp?sid=<%=sidd%>">我的详细资料</a><%=we0%>
		<%
		else

	

			dim s1,s2


				set rs8=Server.CreateObject("Adodb.Recordset")
  				sql8="select pass FROM qingtian_user where sid= '"&qingtian.Formatsid(sid)&"'"
  				rs8.open sql8,conn,1,3
                                if not (rs8.bof and rs8.eof) then
				rs8("pass")=md5(shen)
				rs8.update
                                end if
				rs8.close
				set rs8=nothing
                                qingtian.addong("修改了密码")
       				%>
                                <%=title2%>
				<%=we%>密码修改成功!<br/>
				<a href="usermima.asp?Action=add&amp;sid=<%=sidd%>">返回上级</a><%=we0%>
				<%=sou%><a href="UserInfo.Asp?sid=<%=sidd%>">我的详细资料</a><%=we0%>
				<%		

		end if
		end if
		rs.close
		set rs=nothing


	else
	%>
                <%=title1%>
		<%=errmsg%>
		<%=we%><a href="usermima.asp?Action=add&amp;sid=<%=sidd%>">返回上级</a><%=we0%>
		<%=sou%><a href="UserInfo.Asp?sid=<%=sidd%>">我的详细资料</a><%=we0%>
<%	
end if
end sub
%>

